//
//  BLDestineRoomVC.m
//  Byelone
//
//  Created by 乔小乔 on 2021/2/18.
//

#import "BLDestineRoomVC.h"

@interface BLDestineRoomVC ()
@property (nonatomic, strong) NSString *strDate;
@property (nonatomic, strong) NSString *strTime;
@end

@implementation BLDestineRoomVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"预定会议室";
    [self createUI];
}
- (void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    [self.btnSubmit setGradientBackgroundWithColors:@[[UIColor chColorWithHexString:@"#8881FD"],[UIColor chColorWithHexString:@"#6B71F5"]] locations:@[@(0.0f), @(1.0f)]  startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
}
- (void)createUI{
    UIButton *btnRight = [UIButton buttonWithType:UIButtonTypeCustom];
    [btnRight setTitle:@"会议室预览" forState:UIControlStateNormal];
    btnRight.titleLabel.font = [UIFont systemFontOfSize:16];
    [btnRight setTitleColor:[UIColor chColorWithHexString:@"#6C72F5"] forState:UIControlStateNormal];
    [btnRight addTarget:self action:@selector(clickRightBar) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithCustomView:btnRight];
    self.navigationItem.rightBarButtonItem = item;
}
- (void)clickRightBar{
    
}
- (IBAction)clickAction:(UIButton *)sender {
//    101,102,103
    if (sender.tag == 101) {
        BLCommon_Model_AlertItem *item = [[BLCommon_Model_AlertItem alloc]init];
        item.Id = @"1";
        item.text = @"望京soho";
        [BLPickManager showRoomPickView:@"选择预约地点" array:@[item,item,item] select:^(BLCommon_Model_AlertItem * _Nonnull dateDic) {
            self.labelArea.text = dateDic.text;
            [self disposeSelect];
        }];
    }else if (sender.tag == 102){
        [BLPickManager showDatePickView:^(NSDictionary * _Nonnull dic) {
            self.labelDate.text = dic[@"dateString"];
            self.strTime = dic[@"timestamp"];
            [self disposeSelect];
        }];
    }else if (sender.tag == 103){
        [BLPickManager showDateTimePickView:^(NSDictionary * _Nonnull dic) {
            self.labelTime.text = dic[@"dateTime"];
            [self disposeSelect];
        }];
    }
}

- (void)disposeSelect{
    NSString *str = [NSString stringWithFormat:@"已选：%@\n           %@ %@",self.labelArea.text?:@"",self.labelDate.text?:@"",self.labelTime.text?:@""];
    self.labelSelectInfo.text = str;
}
@end
